import time
def bublesort(masi,N):
    for i in range(N-1):
        for j in range(N-i-1):
            if masi[j]>masi[j+1]:
                masi[j],masi[j+1]=masi[j+1],masi[j]

def readlist(filen):
    file = open(filen,'r')
    data = file.readlines()
    return data
massive_1=readlist("m1_sorted.txt")
razmerchik=len(massive_1)
t_start=time.time()
bublesort(massive_1,razmerchik)
t_finish=time.time()
print("m1_sorted", round((t_finish-t_start)*1000),"milliseconds")

massive_2=readlist("m2_reverse.txt")
razmerchik_2=len(massive_2)
t_start=time.time()
bublesort(massive_2,razmerchik_2)
t_finish=time.time()
print("m2_reverse ", round((t_finish-t_start)*1000),"milliseconds")

massive_3=readlist("m3_shuffle.txt")
razmerchik_3=len(massive_3)
t_start=time.time()
bublesort(massive_3,razmerchik_3)
t_finish=time.time()
print("m3_shuffle ", round((t_finish-t_start)*1000),"milliseconds")
